using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class vStaffDueMap : EntityTypeConfiguration<vStaffDue>
    {
        public vStaffDueMap()
        {
            // Primary Key
            this.HasKey(t => new { t.ItemDesc, t.StaffName, t.DUEG1ACCT, t.DUEG2ACCT, t.PatID, t.InvDate });

            // Properties
            this.Property(t => t.ItemDesc)
                .IsRequired()
                .HasMaxLength(250);

            this.Property(t => t.StaffName)
                .IsRequired()
                .HasMaxLength(35);

            this.Property(t => t.LICENSE_NO)
                .HasMaxLength(15);

            this.Property(t => t.GUAR1_ID)
                .HasMaxLength(6);

            this.Property(t => t.GUAR2_ID)
                .HasMaxLength(6);

            this.Property(t => t.PatName)
                .HasMaxLength(110);

            this.Property(t => t.PatID)
                .IsRequired()
                .HasMaxLength(6);

            this.Property(t => t.Visa_)
                .HasMaxLength(20);

            this.Property(t => t.G1Name)
                .HasMaxLength(110);

            this.Property(t => t.G1AgreeNum)
                .HasMaxLength(20);

            this.Property(t => t.G2Name)
                .HasMaxLength(110);

            this.Property(t => t.G2AgreeNum)
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("vStaffDue");
            this.Property(t => t.ItemDesc).HasColumnName("ItemDesc");
            this.Property(t => t.StaffName).HasColumnName("StaffName");
            this.Property(t => t.LICENSE_NO).HasColumnName("LICENSE_NO");
            this.Property(t => t.DUEG1ACCT).HasColumnName("DUEG1ACCT");
            this.Property(t => t.DUEG2ACCT).HasColumnName("DUEG2ACCT");
            this.Property(t => t.GUAR1_ID).HasColumnName("GUAR1_ID");
            this.Property(t => t.GUAR2_ID).HasColumnName("GUAR2_ID");
            this.Property(t => t.PatName).HasColumnName("PatName");
            this.Property(t => t.PatID).HasColumnName("PatID");
            this.Property(t => t.InvDate).HasColumnName("InvDate");
            this.Property(t => t.Visa_).HasColumnName("Visa#");
            this.Property(t => t.G1Name).HasColumnName("G1Name");
            this.Property(t => t.G1AgreeNum).HasColumnName("G1AgreeNum");
            this.Property(t => t.G2Name).HasColumnName("G2Name");
            this.Property(t => t.G2AgreeNum).HasColumnName("G2AgreeNum");
        }
    }
}
